import scratchlink
import colorlog
import logging

class MyParser(scratchlink.ScratchBleParser):
    def on_display_text(self, txt):
        print('I recieve: '+ txt)

    def on_display(self, bytelist):
        for line in self.led_matrix:
            for led in line:
                print(led, end=' ')
            print('')

if __name__ == '__main__':
    # 设置打印的日志级别，默认INFO，可以改为DEBUG看到更多信息
    colorlog.getLogger('scratchlink').setLevel(logging.INFO)
    scratchlink.ScratchLink(MyParser)